<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta property="wb:webmaster" content="9df9f26d1cd6b732"/>
    <meta property="qc:admins" content="36360132721662163345546375"/>
    <meta http-equiv="X-UA-Compatible" content="IE=10">
    <title>用户登录_交小哇</title>
    <link rel="shortcut icon" href="img/fav.ico"/>
    <link href="oldcss/validate-slide.css" rel="stylesheet" type="text/css" >
    <link rel="stylesheet" type="text/css" href="oldcss/login_ewm.css"/>
    <script language="JavaScript">
        if (window != top) {
            top.location.href = location.href;
        }
    </script>
</head>
<style>
.font-style {
	font-size : 16px;
	color: #D0111A ;
	cursor:pointer;
	border-bottom: 2px solid #D0111A;
	padding-bottom: 4px;
}
</style>

<body>
<div class="login-top">
    <a href="">
        <img src="img/logo1.jpg" width="166" height="76" alt=""/>
        <span>用户登录</span>
    </a>
</div>
<div class="login-bg">
    <div class="login-content">
        <div class="focus">
            <img src="img/login.jpg" width="665" height="500" alt=""/>
        </div>
        <div class="login-box" style="height:auto!important;min-height:320px;">
            <div class="login-type1">
                <div class="login-menu">
                    <input type="hidden" id="formType" value="1"/>
                    <span style="margin-right: 10px" >
                        <a onclick="changeForm(this, false, 1);return false;" id="loginByMobile" class="font-style" style="font-size : 16px; cursor:pointer; text-decoration : none " >短信登录</a></span>
                    <span>
                        <a onclick="changeForm(this, false, 0);return false;" id="loginByPsw" style="font-size : 16px;color: #666666; cursor:pointer; text-decoration : none ">密码登录</a></span>
                </div>
                <div class="login-forms">
                    <div class="login-form">
                        <form id="login" class="form" action="#" method="post" autocomplete="off"
                              style="margin-bottom: 0px;">
                            <fieldset>
                                <input type="hidden" id="mybackurl" name="mybackurl" value="">
                                <input type="hidden" id="type" name="type" value="0">
                                <div class="msg-box" style="height: 28px;margin: 4px 0;overflow: hidden;">
                                    <span id="msg_error" class="msg-box"></span>
                                </div>
                                <div class="form-item form-user userLogin">
                                    <input type="text" id="uname" name="uname" maxlength="50" class="username inputs"
                                           placeholder="手机号码/用户名/邮箱" value="">
                                    <span id="msg-ok1" class="msg-ok"></span>
                                </div>
                                <div class="form-item form-password userLogin">
                                    <input type="password" id="psw" name="psw" value="" maxlength="20"
                                           class="password inputs" placeholder="密码" data-rule="psw">
                                    <span id="msg-ok2" class="msg-ok"></span>
                                </div>
                                <div class="form-item form-user phoneLogin" style="display: none;">
                                    <input type="text" id="phone" name="phone" maxlength="11" class="username inputs"
                                           placeholder="手机号码" value="">
                                    <span id="msg-ok4" class="msg-ok"></span>
                                    <input type="hidden" id="timeLeft" value=""/>
                                </div>
                                <div class="form-item phoneLogin" style="padding-top: 2px;display: none;">
                                    <input type="text" id="phoneCode" name="phoneCode" maxlength="4" value=""
                                           class="inputs short" placeholder="短信验证码">
                                    <span id="msg-ok5" class="msg-ok1"></span>
                                    <input class="btn-code fr" id="sendMessage" type="button" value="获取验证码">
                                    <span id="weak-psw" style="color: red; display: block"></span>
                                </div>
                                <div id="codeDiv" class="form-item lg-identify">
                                    <input type="text" id="code" name="code" maxlength="4" value="" class="inputs short"
                                           data-rule="code" placeholder="验证信息">
                                    <span id="msg-ok3" class="msg-ok1"></span>
                                    <img id="codeImage" src="/Image" width="94" height="33" alt="验证码" class="yzm fr">
                                    <input type="hidden" id="error_num" value="0"/>
                                    <input type="hidden" id="isCodeVali" value="no"/>
                                </div>
                                <div class="form-item">
                                    <input id="button" type="button" value="登 录" class="login-btn">
                                </div>
                            </fieldset>
                        </form>
                        <div class="login-icon">
                            <a class="a1"
                               href="https://graph.qq.com/oauth2.0/authorize?response_type=code&client_id=101224218&redirect_uri=https://www.jiao-xw.com&scope=get_user_info&state=qq"><i></i>QQ登录</a><a
                                class="a2"
                                href="https://open.weixin.qq.com/connect/qrconnect?appid=wxccb6d7d31ad5f7bb&redirect_uri=https%3a%2f%2fwww.jiao-xw.com&response_type=code&scope=snsapi_login&state=weixin#wechat_redirect"><i></i>微信登录</a>
                        </div>
                        <div class="form-psw-find">
                            <span id="showForgetPsw"><a href="findpwd.html">忘记密码？</a></span>
                            <a href="register.html" class="orange">免费注册</a>
                        </div>
                    </div>
                </div>
            </div>
            <div class="login-type2" style="display:none">
                <div class="login-menu"><span>小哇助手扫码登录</span></div>
                <div class="ewm">
                    <div id="ewm-true" class="ewm-true" style="display:block"></div>
                    <div class="ewm-false" style="display:none">
                        <div class="tip">二维码已失效</div>
                        <a class="btn" href="javascript:;">请点击刷新</a>
                    </div>
                    <div class="ewm-tip">
                        <i></i>打开
                        <a class="orange" href="" target="blank">小哇助手</a>扫一扫登录
                    </div>
                </div>
                <div class="form-psw-find">
                    <a class="btn-tozh" href="javascript:;">账号密码登录</a>
                    <i class="tip-line"></i>
                    <a href="register.html" class="orange">免费注册</a>
                </div>
            </div>
        </div>
    </div>
</div>
    <div class="footer bottom">  			
		<p>
			<a target="_blank" href="//www.jiao-xw.com/about/index.html">关于我们</a> | 
			<a target="_blank" href="//www.jiao-xw.com/about/job.html">人才招聘</a>| 
			<a target="_blank" href="//www.jiao-xw.com/about/help.html">帮助中心</a> |
			<a target="_blank" href="//www.jiao-xw.com/about/link.html">友情链接</a>|
			<a target="_blank" href="//www.jiao-xw.com/about/contact.html">联系我们</a> 
		</p>
		<p>
			<b>相关网站：</b>
			<a href="//www.jiao-xw.com" target="_blank" rel="nofollow">交小哇</a> |
			<a href="" target="_blank" rel="nofollow">交通部</a> |
			<a href="" target="_blank" rel="nofollow">中国交通报</a> |
			<a href="" target="_blank" rel="nofollow">交通部科学研究院</a> |
			<a href="" target="_blank" rel="nofollow">中国公路行业建设协会</a> |
			<a href="" target="_blank" rel="nofollow">中国路桥网</a> |
			<a href="" target="_blank" rel="nofollow">中国钢铁网</a> |
			<a href="" target="_blank">北京ISO认证</a> |
			<a href="" target="_blank">52监测网</a> 
		</p>
		<p>copyright@2017zgjtvv.com inc.ALL Rights Reserved. 北京中交创联交通科技有限公司</p>
		<p> 版权所有 <a href="http://beian.miit.gov.cn" target="_blank"> 京ICP备07503900号-8</a></p>
		</div>
<script src="oldjs/stat.js">
</script><script src="oldjs/jquery-1.10.2.js"></script>
<script src="oldjs/base.js"></script>
<script src="oldjs/global.js"></script>
<script type="text/javascript" src="oldjs/login.js?ver=20210316"></script>
<script type="text/javascript" src="oldjs/validate-slide-min.js"></script>
<script type="text/javascript" src="oldjs/jquery.qrcode.js"></script>
<script type="text/javascript" src="oldjs/qrcode.js"></script>

<script type="text/javascript">

    $(function () {
        // 提示图标居中；
        $(".msg-ok").css({
            "top": "2px",
            "right": "-2px"
        });
        $(".msg-ok1").css({
            "top": "10px",
            "left": "160px"
        });

        //获取cookie
        var userNameValue = '';
        if (userNameValue == '' || userNameValue == 'null') {
            userNameValue = getCookieValue("userName");
        }
        $("#uname").val(userNameValue);
        var onlyNumPattern = /^[0-9]+$/;
        if (onlyNumPattern.test(userNameValue)){
            $("#phone").val(userNameValue);
        }

        //-------------------------------------------------------------------------获取第三方登陆所需要的 code state
        //var commonData = new CommonData("www.localhost:8032/logout.htm?state=weibo&code=0b21caf13a10237af9af389e552b6c78");  //code+status参数，若微信用户禁止授权，则重定向后不会带上code参数
        var commonData = new CommonData(window.location.search.substr(1));
        commonData.setLoginCode();
        commonData.setLoginState();

        var code = commonData.loginCode;
        var state = commonData.loginState;
        //------------------------------------------------------------------------使用本系统的账号登录
        var login = new Login();
        login.imgClick();
        login.btnClick();
        login.loginvalidator();

        $('input, textarea').placeholder({customClass: 'my-placeholder'}); 		 //解决ie下input的placeholder文字显示的问题

        //-----------------------------------------------------------------------第三方登陆初始化
        var weiboLogin = new WeiboLogin(code, state);
        var qqLogin = new QQLogin(code);
        var qqBind = new QQBind(code, state);
        var weixinLogin = new WeixinLogin(code);
        var weixinBind = new WeixinBind(code, state);

        //--------------------------------------------------------------------------通过code state判断是执行绑定登录还是普通的登录
        if (code != "") {
            if (state == "qq") {
                qqLogin.qq();
            } else if (state == "qqbind") {
                qqBind.qqbind();
            } else if (state == "weixin") {
                weixinLogin.weixin();
            } else if (state == "weixinbind") {
                weixinBind.weixinBind();
            } else if (state.indexOf("weibo") != -1) {
                weiboLogin.weibo();
            }
        }

        //登录进去后的第三方帐号绑定处理（退出登录重新从单点登录页面进行第三方登录，后台返回state，code为空）
        /*
        if(code == "" )
            {
                if(state=="qqbind")
                {
                    window.location.href = "https://graph.qq.com/oauth2.0/authorize?response_type=code&client_id=101224218&redirect_uri=https://www.jiao-xw.com&scope=get_user_info&state=qq";
                }
                if(state=="weixinbind")
                {
                    window.location.href= "https://open.weixin.qq.com/connect/qrconnect?appid=wxccb6d7d31ad5f7bb&redirect_uri=https%3a%2f%2fwww.jiao-xw.com&response_type=code&scope=snsapi_login&state=weixin#wechat_redirect";
                }
                if(state=="weibobind")
                {
                    window.location.href="https://www.jiao-xw.com/oauth2/authorize?client_id=3641078055&redirect_uri=https%3a%2f%2fwww.jiao-xw.com&response_type=code&state=weibo";
                }
            }
        */
        //过滤用户名前后空格
        $("#uname").change(function () {
            $("#uname").val($.trim($("#uname").val()));
        });

        //验证input输入的内容
        $("#login").validator({
            rules: {
                // 自定义loginName规则，填写用户名、手机号或者邮箱
                uname: function (element) {
                    return /^(?![a-zA-Z]+$)[0-9A-Za-z]{1,20}$/.test(element.value) ||
                            this.test(element, "mobile") === true ||
                            this.test(element, "email") === true ||
                            '您输入的登录名格式有误';
                },
                psw: function (element) {
                    return /^.{6,20}$/.test(element.value) ||
                        this.test(element, "password") === true ||
                            '密码格式不准确';
                },
                phone: function (element) {
                    return this.test(element, "mobile") === true ||
                            '手机号码格式不准确';
                },
                phoneCode: function (element) {
                    return /^[0-9]{4}/.test(element.value) ||
                            '短信验证码aaa格式不准确';
                },
            },
            fields: {
                uname: {
                    rule: "required,uname",
                    target: "#msg_error,#msg-ok1"
                },
                psw: {
                    rule: "required,psw",
                    target: "#msg_error,#msg-ok2"
                },
                code: {
                    rule: "required,code",
                    target: "#msg_error,#msg-ok3"
                },
                phone: {
                    rule: "required,phone",
                    target: "#msg_error,#msg-ok4"
                },
                phoneCode: {
                    rule: "required,phoneCode",
                    target: "#msg_error,#msg-ok5"
                }
            },
            msgWrapper: 'span',
            msgMaker: function (opt) {
                if (opt.type == 'error' && opt.key == 'uname' && opt.rule == 'required') {
                    opt.msg = "登录名不能为空";
                }
                return '<span class="' + opt.type + '">' + opt.msg + '</span>';
            },
            invalidClass: 'text-error',
            display: function (element) {
                return $(element).attr("placeholder");
            }

        });
        //解决ie下input的placeholder文字显示的问题
        $('input[placeholder]').placeholder();

        var preuuid = null;

        //切换扫码登录
        $(".float-ewm").click(function () {
            //获取uuid，不为空时重新生成二维码并且发送登录长连接
            if (document.getElementById("isewm").className == "float-ewm") {
                $.ajax
                ({
                    url: "/get_uuid.htm",
                    type: "post",
                    data: {},
                    dataType: "json",
                    success: function (msg) {
                        var data = eval(msg);
                        if (data.actionStatus == 'success') {
                            var uuid = data.actionMessage;
                            //$(".ewm-true table").remove();
                            // document.getElementById("ewm-true").innerText = "";
                            $("#ewm-true").empty();
                            //uuid获取成功
                            $(".ewm-true").qrcode({
                                text: "http://site.jiao-xw.com/?uuid=" + uuid,
                                correctLevel: QRErrorCorrectLevel.L,
                                width: 158,
                                height: 160
                            });
                            //发送登录长连接
                            sendLongLogin(preuuid, uuid);
                            //记录同一页面上一次请求的uuid
                            preuuid = uuid;
                            $(".ewm-false").hide();
                            $(".ewm-true").show();
                        } else {
                            //uuid获取失败
                            $(".ewm-false").show();
                            $(".ewm-true").hide();
                        }
                    }
                });
            }
            $(".login-type1").toggle();
            $(".login-type2").toggle();
            $(this).toggleClass("float-zh");
        });
        $(".float-ewm-tip").click(function () {
            $.ajax
            ({
                url: "/get_uuid.htm",
                type: "post",
                data: {},
                dataType: "json",
                success: function (msg) {
                    var data = eval(msg);
                    if (data.actionStatus == 'success') {
                        var uuid = data.actionMessage;
                        //$(".ewm-true table").remove();
                        // document.getElementById("ewm-true").innerText = "";
                        $("#ewm-true").empty();
                        //uuid获取成功
                        $(".ewm-true").qrcode({
                            text: "http://www.jiao-xw.com/?uuid=" + uuid,
                            correctLevel: QRErrorCorrectLevel.L,
                            width: 158,
                            height: 160
                        });
                        //发送登录长连接
                        sendLongLogin(preuuid, uuid);
                        //记录同一页面上一次请求的uuid
                        preuuid = uuid;
                        $(".ewm-false").hide();
                        $(".ewm-true").show();
                    } else {
                        //uuid获取失败
                        $(".ewm-false").show();
                        $(".ewm-true").hide();
                    }
                }
            });
            $(".login-type1").toggle();
            $(".login-type2").toggle();
            $(".float-ewm").toggleClass("float-zh");
        });
        $(".btn-tozh").click(function () {
            $(".login-type1").show();
            $(".login-type2").hide();
            $(".float-ewm").removeClass("float-zh");
        });
        $(".ewm-false .btn").click(function () {
            //获取uuid，不为空时重新生成二维码并且发送登录长连接
            $.ajax
            ({
                url: "/get_uuid.htm",
                type: "post",
                data: {},
                dataType: "json",
                success: function (msg) {
                    var data = eval(msg);
                    if (data.actionStatus == 'success') {
                        var uuid = data.actionMessage;
                        //$(".ewm-true table").remove();
                        // document.getElementById('ewm-true').innerText="";
                        $("#ewm-true").empty();
                        //uuid获取成功
                        $(".ewm-true").qrcode({
                            text: "http://site.jiao-xw.com/?uuid=" + uuid,
                            correctLevel: QRErrorCorrectLevel.L,
                            width: 158,
                            height: 160
                        });
                        //发送登录长连接
                        sendLongLogin(preuuid, uuid);
                        //记录同一页面上一次请求的uuid
                        preuuid = uuid;
                        $(".ewm-false").hide();
                        $(".ewm-true").show();
                    } else {
                        //uuid获取失败
                        $(".ewm-false").show();
                        $(".ewm-true").hide();
                    }
                }
            });
        });



        // 刷新页面还需获取当前倒计时；
        var sendTimeLeft = $("#timeLeft").val();
        if (sendTimeLeft.length > 0) {
            startCountdown($(".btn-code"), parseInt(sendTimeLeft));
        }
        // 显示短信验证码输入框；
        // 默认为短信验证码登录
        changeForm($("#changeForm"), false, 1);
    });

    document.onkeydown = function (e) {
        var theEvent = window.event || e;
        var code = theEvent.keyCode || theEvent.which;
        if (code == 13) {
            $("#button").click();
        }
    }

    /**获取cookie的值*/
    function getCookieValue(name) {
        //用处理字符串的方式查找到key对应value
        var name = escape(name);
        //读cookie属性，这将返回文档的所有cookie
        var allcookies = document.cookie;
        //查找名为name的cookie的开始位置
        name += "=";
        var pos = allcookies.indexOf(name);
        //如果找到了具有该名字的cookie，那么提取并使用它的值
        if (pos != -1) {                                             //如果pos值为-1则说明搜索"version="失败
            var start = pos + name.length;                  //cookie值开始的位置
            var end = allcookies.indexOf(";", start);        //从cookie值开始的位置起搜索第一个";"的位置,即cookie值结尾的位置
            if (end == -1) end = allcookies.length;        //如果end值为-1说明cookie列表里只有一个cookie
            var value = allcookies.substring(start, end); //提取cookie的值
            return (value);                           //对它解码
        } else {	//搜索失败，返回空字符串
            return "";
        }
    }

    //统计代码
    var _hmt = _hmt || [];
    (function () {
        var hm = document.createElement("script");
        hm.src = "//hm.baidu.com/hm.js?c3e519f2b38b77d61bde2a133f8d782c";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
    })();

    var ajaxLongLogin = null;

    //发送扫码登录长连接
    function sendLongLogin(preuuid, uuid) {
        if (uuid != "") {
            if (ajaxLongLogin) {
                ajaxLongLogin.abort();
            }
            ajaxLongLogin = $.ajax
            ({
                url: "/erweima_login.htm",
                type: "post",
                timeout: 0,
                data: {"preuuid": preuuid, "uuid": uuid, "mybackurl": "https://site.jiao-xw.com/console/#/buyer/my-purchase"},
                dataType: "json",
                success: function (msg) {
                    var data = eval(msg);
                    if (data.actionStatus == 'success') {
                        var userid = data.actionMessage;
                        location.href = "/member/user_app_login.htm?userId=" + userid + "&returnUrl=" + document.getElementById("mybackurl").value;
                    } else {
                        //二维码失效
                        $(".ewm-false").show();
                        $(".ewm-true").hide();
                    }
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    //二维码失效
                    $(".ewm-false").show();
                    $(".ewm-true").hide();
                },
                complete: function (XMLHttpRequest, status) {
                    //请求完成后最终执行参数
                    if (status == 'timeout' || status == 'error') {//超时,status还有success,error等值的情况
                        ajaxLongLogin.abort();
                        // alert("超时");
                    }
                }
            });

        } else {
            //重新刷新页面
            location.reload();
        }
    }

    // 短信验证码和账号密码登录切换；
    function changeForm(obj, weakPsw, type) {
        // 隐藏校验信息；
        $("#msg_error").hide();

        if (type == 1) {
            // 当前登录方式 0-密码；1-短信
            $("#formType").val(1);
            if (weakPsw){
                $("#weak-psw").text("提醒：您的账户安全级别过低（原因：密码等级为弱等级），请尽快修改密码");
            }
            // 元素显示切换；
            $(".userLogin").hide();
            $(".phoneLogin").show();
            $("#showForgetPsw").hide();
            // 字体下划线显示切换
            $("#loginByMobile").addClass("font-style");
            $("#loginByPsw").removeClass("font-style");
            $("#loginByMobile").css("color", "#D0111A");
            $("#loginByPsw").css("color", "#666666");

            // 初始化滑块验证码
            $('#sendMessage').validateSlide({
				      type:3,
				      checkUrl:"//site.jiao-xw.com/code_x_check.htm",
				      imageCodeUrl:"//site.jiao-xw.com/image_code_info.htm",
				      success:function(){
				        sendCode($('#sendMessage'));
				      },
				      error:function(e){
				      }
					  });
					  $('#sendMessage').on('click',function(){
					    if($("#phone").isValid()){
					     $('#sendMessage').data('plugin_validateSlide').show();
					    } else {
					      $("#msg_error").html("<span class='error'>手机号码格式不准确</span>");
					      $("#msg_error").show();
					    }
					  })
        } else {
            // 字体样式显示切换
            $("#loginByPsw").addClass("font-style");
            $("#loginByMobile").removeClass("font-style");
            $("#loginByPsw").css("color", "#D0111A");
            $("#loginByMobile").css("color", "#666666");
            // 当前登录方式 0-密码；1-短信
            $("#formType").val(0);
            // 元素显示切换；
            $(".userLogin").show();
            $(".phoneLogin").hide();
            $("#showForgetPsw").show();
        }
    }

    // 验证码发送按钮倒计时；
    function startCountdown(obj, countdown) {
        if (obj.timer) {
            return;
        }
        $(obj).prop("disabled", true).val("重新发送（" + countdown + "）");
        var timer = setInterval(function () {
            countdown--;
            $(obj).val("重新发送（" + countdown + "）");
            if (countdown == 0) {
                clearInterval(timer);
                countdown = 60;
                $(obj).prop("disabled", false).val("重新获取");
                obj.timer = undefined;
            }
        }, 1000);
        obj.timer = timer;
    }

    // 发送验证码；
    function sendCode(obj) {
        if ($("#phone").isValid()) {
            $.post("/send_code.htm", {"phone": $("#phone").val()}, function (data) {
                if (data.actionStatus == "success") {
                    $("#msg_error").html("<span class='success'>" + data.actionMessage + "</span>");
                    startCountdown(obj, 60);
                } else {
                    var sendTimeLeft = data.sendTimeLeft;
                    if (sendTimeLeft) {
                        startCountdown(obj, parseInt(sendTimeLeft));
                    }
                    $("#msg_error").html("<span class='error'>" + data.actionMessage + "</span>");
                }
                $("#msg_error").show();
            }, "json");
        } else {
            $("#msg_error").html("<span class='error'>手机号码格式不准确</span>");
            $("#msg_error").show();
        }
    }
</script>
</body>
</html>
